package com.xm;

public class Enum02 {
    public static void main(String[] args) {
        // Gender g1 = new Gender();   构造器私有化，无法使用
        Gender nan1 = Gender.NAN;
        System.out.println(Gender.NAN);
        System.out.println(nan1);

        Gender nan2 = Gender.NAN;
        System.out.println(nan1 == nan2);// true
        System.out.println(nan1.getDescription());

    }

}

class Gender {

    public static final Gender NAN = new Gender("男");
    public static final Gender NV = new Gender("女");

    private String description;

    public String getDescription() {
        return description;
    }

    private Gender(String description) {
        this.description = description;
    }

}